<?php

      // stateCode :  5 用户名和密码不匹配;

      // 1. 获取前端发送的数据;
      // 2. 链接数据库并查询;
      // 3. 返回结果;
			header('Access-Control-Allow-Origin: *');
      $username_zjj = $_POST["username_zjj"];
      $password_zjj = $_POST["password_zjj"];
	  	$username_hyh = $_POST["username_hyh"];
      $password_hyh = $_POST["password_hyh"];
	  	$username_lkk = $_POST["username_lkk"];
      $password_lkk = $_POST["password_lkk"];
	  	$username_xsj = $_POST["username_xsj"];
      $password_xsj = $_POST["password_xsj"];
	  	$username_zbw = $_POST["username_zbw"];
      $password_zbw = $_POST["password_zbw"];
	  	$username_zww = $_POST["username_zww"];
      $password_zww = $_POST["password_zww"];
	  	$username_yzm = $_POST["username_yzm"];
      $password_yzm = $_POST["password_yzm"];
	  
	  

      $db_username = "root";
      $db_password = "123456";
      $db_host = "localhost:3306";

      $con = mysql_connect($db_host,$db_username,$db_password);

      if(!$con){
            $json_arr = array( "statu" => "error" , "stateCode" => "2" , "errorType" => "mySQL error".mysql_error());
            echo  json_encode($json_arr);
      }
      mysql_select_db("group7",$con);
      
//			if($cookie){
//                $password = $cookie;
//          }else{
//                $password = md5($password);
//          }

			if($username_zjj !== null && $password_zjj !== null){
					$password_zjj = md5($password_zjj);
					$select_sql = "select count(*) from user_zjj where (1=1)"." and username_zjj = '$username_zjj'"." and password_zjj = '$password_zjj'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			  //贺云浩的登录
			}elseif($username_hyh !== null && $password_hyh !== null){
					$password_hyh = md5($password_hyh);
					$select_sql = "select count(*) from user_hyh where (1=1)"." and username_hyh = '$username_hyh'"." and password_hyh = '$password_hyh'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			  //刘坤坤的登录
			}elseif($username_lkk !== null && $password_lkk !== null){
					$password_lkk = md5($password_lkk);
					$select_sql = "select count(*) from user_lkk where (1=1)"." and username_lkk = '$username_lkk'"." and password_lkk = '$password_lkk'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			  //薛守江的登录
			}elseif($username_xsj !== null && $password_xsj !== null){
					$password_xsj = md5($password_xsj);
					$select_sql = "select count(*) from user_xsj where (1=1)"." and username_xsj = '$username_xsj'"." and password_xsj = '$password_xsj'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			  //张博威的登录
			}elseif($username_zbw !== null && $password_zbw !== null){
					$password_zbw = md5($password_zbw);
					$select_sql = "select count(*) from user_zbw where (1=1)"." and username_zbw = '$username_zbw'"." and password_zbw = '$password_zbw'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			  //张婉婉的登录
			}elseif($username_zww !== null && $password_zww !== null){
					$password_zww = md5($password_zww);
					$select_sql = "select count(*) from user_zww where (1=1)"." and username_zww = '$username_zww'"." and password_zww = '$password_zww'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			  //袁志敏的登录
			}elseif($username_yzm !== null && $password_yzm !== null){
					$password_yzm = md5($password_yzm);
					$select_sql = "select count(*) from user_yzm where (1=1)"." and username_yzm = '$username_yzm'"." and password_yzm = '$password_yzm'";
					$select_res = mysql_query($select_sql,$con);
					if(mysql_result($select_res,0) ==1){
						$json_arr = array( "statu" => "success" , "stateCode" => "1");
				        die(json_encode($json_arr));
					}else{
						$json_arr = array( "statu" => "error" , "stateCode" => "5", "errorType" => "User name password mismatch", $select_sql);
				      	die(json_encode($json_arr));
					}
			}
      
?>